pp108 : Properties of the Attribute Element

Properties of the Attribute Element

This topic describes the properties of the attribute element in the XML structure of a WS-AppServer model.

An attribute represents a field in database table (primary key) or a class. To create a BusObject, define values for the properties described in the following table.

Property

Description

unique

Determines whether the attribute is part of the unique identifier for the class. The acceptable values are:

  • true
  • false

type

Determines the type of the attribute. The acceptable values are:

Value

Description

relation

Indicates relation to another model.

<attribute type="relation">
    <name>ORDERIDObject</name>
    <type occ="1">ORDERHEADER</type>
    <match>
        <local type="foreignkey">
            <attribute>ORDERID</attribute>
        </local>
        <remote type="primarykey">
            <attribute>ORDERID</attribute>
        </remote>
    </match>
</attribute>

aggregation

Represents an existing class that has an independent existence.

<attribute type="aggregation">
    <name>header</name>
    <layout>nested</layout>
    <type>Distribution::ORDERHEADER</type>
</attribute>

composition

Indicates that the attribute holds a class as a component within it.

<attribute type="composition">
    <name>Father</name>
    <layout>nested</layout>
    <type def="class">
        <class>
            <name>Father</name>
            <type>custom</type>
            <attributes>
                <attribute>
                    <name>Name</name>
                    <type>string</type>
                </attribute>
                <attribute type="composition">
                    <name>Son</name>
                    <layout>nested</layout>
                    <type def="class">
                        <class>
                            <name>Son</name>
                            <type>custom</type>
                            <attributes>
                                <attribute>
                                    <name>Name</name>
                                    <type>string</type>
                                </attribute>
                            </attributes>
                        </class>
                    </type>
                </attribute>
            </attributes>
        </class>
    </type>
</attribute>

<name>

Indicates the name of the attribute

<java><name>

Indicates the name that is used to generate the accessor and mutator methods of an attribute.For example, in an attribute which hasCustomerIDas the<name>andCustIDas the<java><name>, the following accessor and mutator methods are generated:

  • public void setCustId(String value)
    public String getCustId()

  • public String getCustId()

    Note: The <java><name> values take precedence over <name> values, while generating these methods.

<type>

Represents the data type of the attribute. The acceptable values belong to the following categories:

  • BasicType
  • ClassType

<size>

Based on the data type, this element indicates the size of the attribute. Use this element only if the data type requires it (for example, string).

<maxLength>

Based on the type, it indicates the maximum length of the attribute.

<minLength>

Based on the type, it indicates the minimum length of the attribute

<length>

Based on the type, it indicates the exact length of the attribute.

<minInclusive>

Indicates the lower bound of the value, with the value included.

<maxExclusive>

Indicates the upper bound of the value, with the value excluded.

<derived>

Indicates the class from which this attribute is derived.

<scale>

Indicates the number of digits to the right of the decimal point.

<precision>

Indicates the total number of digits used.

<pattern>

Indicates the pattern that the attribute must match, based on the type of attribute.

<initial>

Indicates the initial value of the attribute. The initial value will be applicable only for validate requests.

<changeability>

Indicates the changeability of the attribute. The acceptable values are as follows:

Value

Description

changeable

Value can be modified at any point of time

frozen

Value assigned during creation of the object but cannot be modified subsequently

add only

Value can be assigned anytime (during insert or update operation) but only once, and cannot be modified subsequently


<persistence>

Determines the mode of persistence. The acceptable values are:

  • Blank (Persistent) - Default mode of mapping to a database column
  • Transient - Attribute does not map to a database column and is not persisted

<required>

Indicates the necessity of providing a value for the attribute. The acceptable values are:

  • True - the attribute must have a value
  • False - the attribute does not require a value
    This property allows you to determine whether to allow null values for a particular attribute or not . Based on the specification, WS-AppServer generates Java code to create the necessary constraint that will be used during validation. If nothing is specified,falseis taken as the default value.


Related tasks

Viewing and Editing the XML Structure of a WS-AppServer Model

Related reference

Properties of the Class Element
Properties of the Method Element
Properties of the Parameter Element
Properties of the Relation Attribute
Properties of the Type Element